<?php

function ConvertProfileTOURL($name, $userID, $profileID)
{
	$profileURL = "<a href=\"profile/home/$userID/$profileID\" class=\"viewprofile\"	userid='$userID' profileid='$profileID'> $name </a>";

	return $profileURL;
}

function time_stamp($session_time)
	{

		$time_difference = time() - $session_time ;
		$seconds = $time_difference ;
		$minutes = round($time_difference / 60 );
		$hours = round($time_difference / 3600 );
		$days = round($time_difference / 86400 );
		$weeks = round($time_difference / 604800 );
		$months = round($time_difference / 2419200 );
		$years = round($time_difference / 29030400 );

		if($seconds <= 60)
		{
			return "$seconds seconds";
		}
		else if($minutes <=60)
		{
			if($minutes==1)
			{
				return "one minute";
			}
			else
			{
				return "$minutes minutes";
			}
		}
		else if($hours <=24)
		{
			if($hours==1)
			{
				return  "one hour";
			}
			else
			{
				return  "$hours hours";
			}
		}
		else if($days <=7)
		{
			if($days==1)
			{
				return "one day";
			}
			else
			{
				return  "$days days";
			}
		}
		else if($weeks <=4)
		{
			if($weeks==1)
			{
				return  "one week";
			}
			else
			{
				return  "$weeks weeks ";
			}
		}
		else if($months <=12)
		{
			if($months==1)
			{
				return  "one month ";
			}
			else
			{
				return  "$months months ";
			}
		}
		else
		{
			if($years==1)
			{
				return  "one year ";
			}
			else
			{
				return "$years years ";
			}

		}
	}
	

?>
